# 1.获取用户输入并转为数组
str = input("请输入你要查询的城市和项目以空格分隔：")
target = str.split(" ")
print(target)

# 2，读取文件
fr = open("C:/Users/Administrator/Desktop/Desktop/xiaofei.csv", "r")
ls = []
for line in fr:
    line = line.replace("\n", "")
    ls.append(line.split(","))

# 3.查找并记录输入的省在第几行
x = 0
for i in range(len(ls)):
    if (ls[i][0] == target[0]):
        x = i
        print("你输入的城市是： {}".format(ls[x][0]))

# 4.查找项目       
for j in range(len(ls[0])):
    for z in range(len(target)):
        if (ls[0][j] == target[z]):
            print("{}的消费金额为： {}".format(ls[0][j], ls[x][j]))
